<template>
  <el-drawer
    :visible.sync="drawer"
    direction="rtl"
    size="50%"
    :with-header="false"
    :width="500"
  >
    <div class="drawer_box">
      <div class="drawer_title">
        <div class="drawer_t">
          <div class="drawer_t_l">
            <img
              class="drawer_t_l_img"
              src="/static/skin/herodoo/main/platform/home/img/piliangoumai.png"
              alt=""
            />
            查看用户勋章管理信息
          </div>
          <img
            class="drawer_t_r"
            src="/static/skin/herodoo/main/platform/home/img/guanbi.png"
            alt=""
            @click="drawer = false"
          />
        </div>
      </div>
      <div class="drawer_content" v-if="detail">
        <div class="list-box">
          <div class="left">用户昵称：</div>
          <div class="right">{{ detail.NickName }}</div>
        </div>
        <div class="list-box">
          <div class="left">联系方式：</div>
          <div class="right">{{ detail.Mobile }}</div>
        </div>
        <div class="list-box">
          <div class="left">年龄：</div>
          <div class="right">{{ detail.Age }}</div>
        </div>
        <div class="list-box">
          <div class="left">性别：</div>
          <div class="right">{{ detail.Sex }}</div>
        </div>
        <!--  -->
        <div class="list-box flex" v-for="(item, i) in medals" :key="i">
          <div class="medals">
            <img :src="getImg(item)" alt="" />
            <div>
              <div class="name">
                勋章名称：<span>{{ item.Name }}</span>
              </div>
              <div class="name">
                获取时间：<span>{{ item.CreateTime }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </el-drawer>
</template>

<script>
export default {
  name: "look",

  data() {
    return {
      octopus: this.$parent.octopus,
      drawer: false,
      detail: null,
      medals: []
    };
  },
  computed: {},
  mounted() {},

  methods: {
    drawerOpen(data) {
      this.drawer = true;
      this.detail = data;
      this.api_1313(data.ID);
    },
    getImg(item) {
      let url =
        item.PicturePath != "" ? JSON.parse(item.PicturePath)[0].url : "";
      return url;
    },
    //获取用户 勋章
    api_1313(ID) {
      this.octopus.request.api.post(
        "/Octopus/Engine/List",
        {
          id: 1313,
          cellData: [
            { name: "CreateTime" }, // 勋章获得时间
            { name: "ID" }, // ID
            { name: "Name" }, // 勋章名称
            { name: "PicturePath" } // 勋章地址
          ],
          paramData: {
            CreateUserID: ID
          }
        },
        data => {
          if (data.status.code == 200) {
            this.medals = data.content.queryData;
          } else {
            this.octopus.tips.error(data);
          }
        }
      );
    }
  }
};
</script>

<style scoped>
.drawer_box {
  padding: 3rem 0.8rem 3rem 0;
  height: calc(100% - 5rem);
  display: flex;
  flex-direction: column;
}

.drawer_title {
  box-shadow: 0px 5px 5px rgb(230 228 228 / 30%);
  padding-bottom: 1rem;
  font-size: 1.6rem;
}

.drawer_t {
  padding: 0 2.8rem;
  display: flex;
  justify-content: space-between;
}

.drawer_t_l {
  display: flex;
  align-items: center;
  font-size: 2rem;
  font-weight: bold;
}

.drawer_t_l_img {
  width: 2.8rem;
  margin-right: 1rem;
}

.drawer_t_r {
  width: 3rem;
  height: 3rem;
  cursor: pointer;
}

.button_box {
  margin-top: 1rem;
  padding: 0 3rem;
  display: flex;
}

.drawer_content {
  overflow-y: auto;
  margin-top: 1.5rem;
  height: calc(100vh - 11rem);
  padding: 0 3rem;
  width: 100%;
  padding-bottom: 1rem;
}

.drawer_content .title {
  font-size: 1.8rem;
  font-weight: bold;
}

.drawer_content .driver-title {
  margin-top: 1em;
}

.content-box {
  display: flex;
  align-items: center;
  margin: 2rem 0 2rem 2em;
}

.mt-10 {
  margin-top: 10rem;
}

.content-box .label {
  width: 25%;
  font-size: 1.6rem;
}

.content-box .label .label-bold {
  font-size: 1.8rem;
  font-weight: bold;
}

.content-box .desc {
  flex: 1;
  font-size: 1.6rem;
}

.list-box {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.list-box {
  line-height: 4rem;
  margin-top: 2rem;
}

.list-box .left {
  width: 20%;
  font-size: 1.5rem;
}

.list-box .right {
  width: 80%;
}
.medals {
  width: 100%;
  border: 1px solid #393939;
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  padding: 10px;
  margin: 0 10px 15px 0;
}
.medals img {
  width: 16rem;
  /* height: 22rem; */
}
.medals .name span {
  margin-left: 20px;
}
.flex {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
</style>
